package com.qf.service.impl;

import com.qf.dao.UserDao;
import com.qf.pojo.User;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author bss
 * @version V1.0
 * @Project maven
 * @Package com.qf.service.impl
 * @Description:
 * @Date 2022/10/2 15:35
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserDao userDao;

    @Override
    public List<User> findall() {
        return userDao.findall();
    }

    @Override
    public User findByUsername(String username) {
        User byUserName = userDao.findByUserName(username);
        return byUserName;
    }

    @Override
    public boolean register(User user) {
        int add = userDao.add(user);
        return add>0;
    }

    @Override
    public User findByUserAndPwd(String username, String password) {
        User userAndPwd = userDao.findByUserAndPwd(username, password);
        return userAndPwd;
    }

    @Override
    public User findByEmail(String email) {
        User user = userDao.checkEmail(email);
        return user;
    }
}
